Repository navigation
fix(id-mail): validate() reports null/non-object config entries instead of crashing; retire optional in the deploy flow - #6948
Merged
Conversation
…ad of crashing; retire optional in the deploy flow (#6947)
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Caution Review failedThe pull request is closed.
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #6947.
deploy.mjs'svalidate()is the fail-closed gate for the id-mail Worker deploy (#3281 discipline), but it crashed on the malformed shapes it exists to catch, and it blessed a config the deploy flow then crashed on:~/git/fleet/probe-idmail-deploy, realdeploy.mjs+ stub bws/wrangler/fetch): top-levelnull→ TypeError at the first check;templates: [null], a null caller, and a null grant → TypeErrors naming no config field;transports: "email"/5→(c.transports ?? []).every is not a function(and, for a number,c.transports?.includes is not a functionat the grant check);templates: 5/{}→ not-iterable TypeError. A merely wrong scalar (bad worker name) was already reported correctly through the aggregatedconfig.json is invalid:error.retiremismatch:validate()treatsretireas optional (c.retire ?? []) while the deploy sequence iteratedconfig.retireunconditionally — a retire-less config passed--dry-run("config is valid") and then crashed the real deploy at the retire loop, after the bws read and wrangler dry-run had already run.Fix (deploy.mjs only):
validate()returns["config must be a JSON object"]for a non-object top level instead of dereferencing it.transportslist operations go through one normalizedtransportList(empty when not an array); the existingisStringListcheck reports the shape.templates[<i>] must be an object with subject and body; caller and grant entries get the same named-object guard.config.retire ?? [], matching validation.Tests (deploy.test.mjs, same stub harness): makeSandbox learned config overrides (raw or mutate) with crash-safe bws key derivation; new cases pin all seven malformed shapes to the aggregated validation error with zero external calls and no TypeError, and pin a retire-less config to a full stubbed deploy. New tests fail pre-fix (2 fail / 4 pass), pass post-fix; full worker suite (deploy + runtime) 11/11 on the laptop. Post-fix probe: every malformed shape now ends in the aggregated error, control + retire-less deploys exit 0.
Open in [code]smith · Need help on this PR? Tag
@codesmith-botwith what you need.